home *** CD-ROM | disk | FTP | other *** search
-
- PEEKs, POKEs, and SYSes -- Part 31
-
- by Alan Gardner
-
-
-
- The next portion of ROUTINES V4 is a
-
- routine called LINPUT. LINPUT is
-
- used to input up to 80 characters from
-
- any input device. This routine
-
- allows use of such things as commas
-
- and colons without getting an ?EXTRA
-
- IGNORED error. LINPUT inputs
-
- characters until a carriage return
-
- [CHR$(13)] has been found.
-
- In using LINPUT, the file to access
-
- must be OPENed prior to using the
-
- routine. For example, let's say we
-
- wanted to read a SEQuential file
-
- called TEXTSTUFF. To use LINPUT, we
-
- must use a few KERNAL routines to
-
- help. These are CHKIN and CLRCHN.
-
- To use LINPUT in our example, you
-
- could do the following:
-
- 5 IFX=0THENX=1:LOAD"ROUTINES V4",8,1
- 6 :
- 10 OPEN 2,8,2,"TEXTSTUFF"
- 20 POKE 781,2 : SYS 65478 :REM _CHKIN
- 30 SYS 52016,A$ :REM _LINPUT
- 40 B$=MID$(A$,1)
- 50 PRINT B$ : IF ST=0THEN 30
- 60 SYS 65484 :REM _CLRCHN
- 70 CLOSE 2
-
-
- The CHKIN routine used in line 20
-
- is to OPEN channel two for input.
-
- The number in the 'POKE 781,' must
-
- be the first number in the OPEN
-
- statement. For example:
-
-
- OPEN STATEMENT POKE STATEMENT
- {CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}
-
- OPEN 3,8,4,"name" POKE 781,3
- OPEN 4,8,4,"name" POKE 781,4
- OPEN 6,8,3,"name" POKE 781,6
-
-
- Line 30 is the actual SYS to LINPUT.
-
- Because LINPUT puts our string (A$) at
-
- a different memory location than
-
- BASIC does, we must make a
-
- reassignment of the string. This is
-
- done in line 40. After line 40, the
-
- actual input from TEXTSTUFF is
-
- contained in B$. Line 50 prints our
-
- string (B$) and then tests to see
-
- if end-of-file has been reached. If
-
- end-of-file has been reached then we
-
- fall through to lines 60 and 70. Line
-
- 60 clears all of the input/output
-
- channels and line 70 actually closes
-
- our file. If end-of-file has not been
-
- reached, then we return to line 30 to
-
- get some more text.
-
-
- ** NOTE **
-
- Do NOT attempt to input a string
- that is more than 80 characters
- long. It will crash the system!!!
-
-
-
- The next portion of ROUTINES V4 is
-
- reserved for COLORLISTER. COLORLISTER
-
- is a small routine which patches
-
- itself into the LIST routine.
-
- COLORLISTER puts an end to boring
-
- single colored listings.
-
- To activate COLORLIST, all you need
-
- is SYS 52080. To change the default
-
- colors of your listing, change the
-
- text color and/or background color.
-
- Text color is changed by pressing the
-
- CTRL or Commodore key along with a
-
- key 1-8. Background color is changed
-
- with a POKE 53281,xx (xx should range
-
- between 0 and 15). After changing
-
- your colors, all you need to do is
-
- a SYS 52102.
-
-
- The last part of ROUTINES V4 is known
-
- as USR(PEEK). If you are familiar
-
- with the layout of the C-64, then you
-
- know that in some places there is
-
- RAM hidden under ROM. We can POKE
-
- things into this RAM easily enough,
-
- but PEEKing from this RAM is nearly
-
- impossible (without USR(PEEK) that
-
- is). USR(PEEK) 'looks' under the
-
- ROM into the RAM to get its values.
-
- For example:
-
-
- PRINT PEEK(58909) will yield 48
-
- while
-
- PRINT USR(58909) will yield 247
-
-
- There is no SYS to turn USR(PEEK) on
-
- and off, rather there is one SYS to
-
- activate it. This SYS is SYS 52176.
-
-
- =========< end of article >===========
-